<?php
$grand_total = 0;

if ($cart = $this->cart->contents()) {
    foreach ($cart as $item) {
        $grand_total = $grand_total + $item['subtotal'];
    }
}

?>
<!DOCTYPE html>
<head>
    <title>Billing Info</title>
</head>
<style>
    body{
        background-color:moccasin;
    }
</style>
<body>
<form name="billing" method="post" action="billing/save_order">
    <input type="hidden" name="command" />
    <div align="center">
        <h1 align="center">Billing Info</h1>
        <table border="0" cellpadding="2px">
            <tr><td>Order Total:</td><td><strong>$<?php echo number_format($grand_total,2); ?></strong></td></tr>
            <tr><td>Creditcard Number:</td><td><input type="text" name="number" pattern="[0-9]{16}" maxlength="16" required/></td></tr>
            <tr><td>Creditcard Expiry:</td><td><select name="month" required>
                                                                    <?php
                                                                        /* Create option for all months from now. */
                                                                        $m = intval(date("m")) + 1;
                                                                        for ($i = $m; $i <= 12; $i++) {
                                                                            echo "<option value=\"$i\">$i</option>\n";
                                                                        }
                                                                    ?>
                                                </select>
                                                <select name="year" required>
                                                                    <?php
                                                                        /* Create options for all years up to six years from now. */
                                                                        $y = intval(date("Y"));
                                                                        for ($i = $y; $i <= $y + 8; $i++) {
                                                                            echo "<option value=\"$i\">$i</option>\n";
                                                                        }
                                                                    ?>
                                                </select></td></tr>
            <tr><td>&nbsp;</td><td><input type="submit" value="Finalize Order"/></td></tr>
        </table>
    </div>

</form>
</body>
</html>
